import {requested} from './axiosed';
//新增博文
export async function addArticle(title, content) {
    var url = '/api/article/add?title='+title+'&content='+content;
    let res = await requested(url);
    return res.data.data.data;
}
//博文获取总条数
export async function getArticleCount() {
    var url = '/api/article/count';
    let res = await requested(url);
    return res.data.data;
}
// 获取一条博文
export async function getArticle(id) {
    var url = '/api/article/read/';
    if (id !== undefined) {
        url+=id;
    }
    let res = await requested(url);
    return res.data.data;
}
//获取一页博文，默认第一页，一页十条
export async function getArticleList(curPage = 1,pageSize = 5) {
    var url = '/api/article/readList?curPage='+curPage+'&pageSize='+pageSize;
    let res = await requested(url);
    return res.data.data.data;
}
//获取一截时间流
export async function getTimeList(curPage = 1,pageSize = 10) {
    var url = '/api/article/timeList?curPage='+curPage+'&pageSize='+pageSize;
    let res = await requested(url);
    return res.data.data.data;
}
//更新博文信息
export async function updateArticle(id, title, content) {
    var url = '/api/article/update?id='+id+'&title='+title+'&content='+content;
    let res = await requested(url);
    return res.data.data.data;
}
//删除博文
export async function deleteArticle(id) {
    var url = 'api/article/delete/';
    if (id !== undefined) {
        url+=id;
    }
    let res = await requested(url);
    return res.data.data;
}
//点赞数加一
export async function articleLikeCountUp(id) {
    var url = 'api/article/likeCountUp';
    if (id !== undefined) {
        url+=id;
    }
    let res = await requested(url);
    return res.data.data;
}
